package com.www.conversionspring.service;

import com.www.conversionspring.beans.Computer;
import com.www.conversionspring.beans.Mobile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.convert.ConversionService;
import org.springframework.core.convert.TypeDescriptor;
import org.springframework.stereotype.Service;

/**
 * <p>
 * </p>
 *
 * @author Zed.Yun
 * @Title: MyConverterService
 * @ProjectName conversion-spring
 * @date 2019/3/18 13:55
 */
@Service
public class MyConverterService  {
    @Autowired
    private ConversionService conversionService;
    @Autowired
    public MyConverterService(ConversionService conversionService) {
        this.conversionService = conversionService;
    }


    public Computer convertToComputer(Mobile mobile){
        Computer convert = conversionService.convert(mobile, Computer.class);
        return convert;
    }

}
